package com.project.shiro;

import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.SimpleAuthenticationInfo;
import org.apache.shiro.authc.credential.HashedCredentialsMatcher;
import org.apache.shiro.authz.AuthorizationInfo;
import org.apache.shiro.authz.SimpleAuthorizationInfo;
import org.apache.shiro.realm.AuthorizingRealm;
import org.apache.shiro.subject.PrincipalCollection;
import org.apache.shiro.util.ByteSource;
import org.springframework.stereotype.Component;

import java.util.List;
@Component

public class CustomRealm extends AuthorizingRealm {

//    public CustomRealm(){
//        //创建凭证匹配器
//        HashedCredentialsMatcher matcher = new HashedCredentialsMatcher();
//        //设置加密算法
//        matcher.setHashAlgorithmName("md5");
//        //设置散列次数
//        matcher.setHashIterations(1024);
//        //设置加密的编码，为true表示Hex编码，false用Base64
//        matcher.setStoredCredentialsHexEncoded(true);
//        //将realm设置凭证管理器
//        this.setCredentialsMatcher(matcher);
//
//    }

    /**
     * 授权的方法
     * @param principalCollection
     * @return
     */
    @Override
    protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principalCollection) {


        return null;
    }

    /**
     *认证的方法
     * @param authenticationToken
     * @return
     * @throws AuthenticationException
     */


    @Override
    protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authenticationToken) throws AuthenticationException {


        return null;
    }
}
